import json

from model.ReqRouterCommandEnum import ReqRouterCommandEnum
from model.WebsocketClientVO import WebsocketClientVO


class UploadDataService():
    def __init__(self, clientVO:WebsocketClientVO):
        self.clientVO = clientVO

    def upload(self, data, command: ReqRouterCommandEnum):
        req = {
            'command': command.value[0],
            'data': data,
            'device_id': self.clientVO.clientInfo
        }
        j = json.dumps(req)
        self.clientVO.serverWs.send(j)


